﻿using System;
using System.Collections.Generic;
using System.Text;

namespace LocalizationTest.Tools
{
  public struct Function2D
  {
    public Function2D(float x, float y, double value)
    {
      this.x = x; this.y = y; this.value = value;
    }
    public float x;
    public float y;
    public double value;
  };

  public struct FunctionWorldState
  {
    public FunctionWorldState(WorldState worldState, double value)
    {
      this.worldState = worldState; this.value = value;
    }
    public WorldState worldState;
    public double value;
  };

  public class Vector2
  {
    public Vector2()
    {
      this.x = 0;
      this.y = 0;
    }
    public Vector2(double x, double y)
    {
      this.x = x;
      this.y = y;
    }
    public double x;
    public double y;

    public static Vector2 operator +(Vector2 a, Vector2 b)
    {
      return new Vector2(a.x + b.x, a.y + b.y);
    }
    public static Vector2 operator -(Vector2 a, Vector2 b)
    {
      return new Vector2(a.x - b.x, a.y - b.y);
    }

    public static Vector2 operator /(Vector2 a, double b)
    {
      return new Vector2(a.x / b, a.y / b);
    }

    public static Vector2 operator *(Vector2 a, double b)
    {
      return new Vector2(a.x * b, a.y * b);
    }

    public double Abs()
    {
      return Math.Sqrt(x * x + y * y);
    }

    public double GetAngle()
    {
      return Math.Atan2(y, x);
    }

    public void Normalize()
    {
      double abs = Abs();
      x /= abs;
      y /= abs;
    }

  }
}
